//  apis.js 用于定义前后端各种接口
//  获取axios封装方法
import req from './http.js'
import global from '../global.vue'

// var baseURL = global.baseUrl
var baseUserUrl = global.baseUserUrl
var bussinessManUrl = global.bussinessManUrl
var dataManUrl = global.dataManUrl
var tranEstiUrl = global.tranEstimateUrl
var tranProUrl = global.tranProduct
/*
 *Login——登录页接口
 */
// 定义登录
export const LOGIN = (params, func) =>
  req(params, func, dataManUrl + '/rest/auth/login', 'post')
// 定义登出
export const LOGOUT = (params, func) =>
  req(params, func, dataManUrl + '/rest/auth/logout', 'post')

/*
 *Home——首页接口
 */
// 获取用户姓名

export const GETUSERNAME = (params, func) =>
  req(params, func, 'http:// 192.168.1.100:8080/user/getCurrent', 'get')
// 添加/修改用户
export const RESETUSERPASSWORD = (params, func) =>
  req(params, func, 'http:// 192.168.1.100:8080/user/updatePassword', 'post')
// 获取临期提醒数据
export const GETDEADLINETIP = (params, func) =>
  req(params, func, '/api/tip.json', 'get')
// 获取数据简报
export const GETDATAPAPER = (params, func) =>
  req(params, func, '/api/dataPaper.json', 'get')
// 获取军民分布
export const GETJMZBPIEDATA = (params, func) =>
  req(params, func, '/api/JMZBPieData.json', 'get')
// 获取等级数量
export const GETDJSLDATA = (params, func) =>
  req(params, func, '/api/DJSLData.json', 'get')
// 获取等级分布
export const GETDJFBPIEDATA = (params, func) =>
  req(params, func, '/api/DJFBPieData.json', 'get')
// 获取企业漏斗
export const QYLDFUNNELDATA = (params, func) =>
  req(params, func, '/api/QYLDFunnelData.json', 'get')

/**
 * 数据管理平台接口
 *  导航原始数据
 */
/*
 *菜单接口
 */
// 增加菜单
export const ADDMENU = (params, func) =>
  req(params, func, dataManUrl + '/rest/datamng/menu/addOneMenu', 'post')
// 获取单位树
export const GETUNITTREE = { url: '/api/unitTree.json', type: 'get' }
// 获取所有数据
export const GETALLLIST = {
  url: dataManUrl + '/rest/import/approvecommon',
  type: 'post'
}
// 获取所有审核通过的数据
export const GETALLACCEPTLIST = {
  url: dataManUrl + '/rest/import/queryAccepted',
  type: 'post'
}
// 今日提交（审批）数据统计
export const GETSUBMITDATA = (params, func) =>
  req(params, func, dataManUrl + '/rest/datamanage/common/todaydataCount', 'post')
// 今日未审批、已审批、提交各类数据占比
export const GETSUBMITPERCENT = (params, func) =>
  req(params, func, dataManUrl + '/rest/datamanage/common/approveRate', 'post')
// 近7日各类数据的提交数目
export const GETWEEKDATA = (params, func) =>
  req(params, func, dataManUrl + '/rest/datamanage/common/sevenDayAdd', 'post')
// 统计各类数据
export const GETDATASIZE = (params, func) =>
  req(params, func, dataManUrl + '/rest/import/size?menuId=' + params.menuId, 'get')
// 统计各类数据条数
export const GETDATAFILENUM = (params, func) =>
  req(params, func, dataManUrl + '/rest/import/filenum?menuId=' + params.menuId, 'get')
// 获取所有年份
export const GETALLYEAR = (params, func) =>
  req(params, func, dataManUrl + '/rest/file/AllYear', 'post')
// 获取所有区域
export const GETALLREGION = (params, func) =>
  req(params, func, dataManUrl + '/rest/file/AllRegion', 'post')
// 获取文件类型
export const GETALLTYPE = (params, func) =>
  req(params, func, dataManUrl + '/rest/file/AllFtype', 'post')
// 获取文件状态
export const GETALLSTATUS = (params, func) =>
  req(params, func, dataManUrl + '/rest/file/Allstatus', 'post')
// 文件上传
export const UPLOADFILE = {
  url: dataManUrl + '/rest/import/uploadFile',
  accept: '.xls, .xlsx'
}
// 文件清空
export const CLEARUPLOAD = (params, func) =>
  req(params, func, dataManUrl + '/rest/import/clearUploadFile', 'post')
// 文件导入
export const IMPORTFILE = (params, func) =>
  req(params, func, dataManUrl + '/rest/import/subcommon', 'post')
// 文件上传更新
export const UPLOADFILEUPDATE = {
  url: dataManUrl + '/rest/import/updateFile'
  // accept: '.xls, .xlsx'
}
// export const UPLOADFILEUPDATE = (params, func) =>
//   req(params, func, dataManUrl + '/rest/import/updateFile', 'post')
// 文件清空更新
export const CLEARUPLOADUPDATE = (params, func) =>
  req(params, func, dataManUrl + '/rest/import/clearUpdate', 'post')
// 文件导入更新
export const IMPORTFILEUPDATE = (params, func) =>
  req(params, func, dataManUrl + '/rest/import/update', 'post')
// 获取所有待审核的数据
export const GETAPPROVALLIST = {
  url: dataManUrl + '/rest/import/approves',
  type: 'post'
}
// 审批通过
export const APPROVALACCEPT = (params, func) =>
  req(params, func, dataManUrl + '/rest/import/accept', 'post')
// 审批拒绝
export const APPROVALREJECT = (params, func) =>
  req(params, func, dataManUrl + '/rest/import/reject', 'post')
// 删除数据
export const APPROVALDLETE = (params, func) =>
  req(params, func, dataManUrl + '/rest/import/delcommon', 'post')

// HZJ START
// 获取点线面所有数据
export const GETPLPALLLIST = {
  url: dataManUrl + '/rest/plp/approvesplp',
  type: 'post'
}
// 获取通过点线面所有数据
export const GETPLPACCEPTLIST = {
  url: dataManUrl + '/rest/plp/plpqueryAccepted',
  type: 'post'
}

// 点线面审批通过
export const PLPAPPROVALACCEPT = (params, func) =>
  req(params, func, dataManUrl + '/rest/plp/acceptplp', 'post')
// 点线面审批拒绝
export const PLPAPPROVALREJECT = (params, func) =>
  req(params, func, dataManUrl + '/rest/plp/rejectplp', 'post')
// 点线面删除
export const PLPDELETE = (params, func) =>
  req(params, func, dataManUrl + '/rest/plp/delplp', 'post')
// HZJ END

// hubin insert start
// 获取所有轨迹数据
export const GETALLTRACELIST = {
  url: dataManUrl + '/rest/trace/approvestrace',
  type: 'post'
}

// 获取所有通过轨迹数据
export const GETTRACEACCEPTLIST = {
  url: dataManUrl + '/rest/trace/traceQueryAccepted',
  type: 'post'
}
// 轨迹数据审批通过
export const TRACEAPPROVALACCEPT = (params, func) =>
  req(params, func, dataManUrl + '/rest/trace/accepttrace', 'post')
// 轨迹数据审批拒绝
export const TRACEAPPROVALREJECT = (params, func) =>
  req(params, func, dataManUrl + '/rest/trace/rejecttrace', 'post')
// 轨迹数据删除
export const TRACEDELETE = (params, func) =>
  req(params, func, dataManUrl + '/rest/trace/deltrace', 'post')
// 数据管理菜单
export const GETDATAMANAGEMENU = (params, func) =>
  req(params, func, dataManUrl + '/rest/datamng/menu/showMenuTree', 'post')
// 删除目录树
export const DELETEMENUTREE = (params, func) =>
  req(params, func, dataManUrl + '/rest/datamng/menu/deleteMenuTree', 'post')
// 获取menuId
export const GETMENUID = (params, func) =>
  req(params, func, dataManUrl + '/rest/datamng/menu/keytoid', 'post')
// 修改目录
export const UPDATEMENU = (params, func) =>
  req(params, func, dataManUrl + '/rest/datamng/menu/updateMenu', 'post')
export const GETPLOYGON = (params, func) =>
  req(params, func, dataManUrl + '/rest/progeom/areaTopolygon', 'post')
export const GETPATHBYNAME = (params, func) =>
  req(params, func, dataManUrl + '/rest/progeom/menuAndArea', 'post')
export const GETNAMERULE = (params, func) =>
  req(params, func, dataManUrl + '/rest/city/nameChange', 'post')
export const GETPATHBYPLOGY = (params, func) =>
  req(params, func, dataManUrl + 'rest/progeom/menuAndPgon', 'post')
export const PROTASKPACK = (params, func) =>
  req(params, func, dataManUrl + '/rest/prod/task/package', 'post')
// hubin insert end
/**
 *业务管理系统的请求方法定义
 *包括业务管理系统各个调用接口
 *方便后续拆分数据管理和业务管理
 *****/
// 统计今日提交的生产需求个数
export const GETTODAYPRODUCTDNEED = (params, func) =>
  req(params, func, bussinessManUrl + '/rest/datamanage/demandtask/todaydemandsub', 'post')
// 统计今日下发/审批/截止任务个数
export const STATISTICSTASK = (params, func) =>
  req(params, func, bussinessManUrl + '/rest/datamanage/demandtask/todaytask', 'post')
// 评估任务数和生产任务数之比
export const ESTIMATEPRODUCTPERCENT = (params, func) =>
  req(params, func, bussinessManUrl + '/rest/datamanage/demandtask/taskpercent', 'post')
// 评估需求数和生产需求数之比
export const NEEDPERCENT = (params, func) =>
  req(params, func, bussinessManUrl + '/rest/datamanage/demandtask/demandpercent', 'post')
// 近七日每日任务统计数
export const WEEKTASKSTATISTIC = (params, func) =>
  req(params, func, bussinessManUrl + '/rest/datamanage/demandtask/sevenDayTotal', 'post')
// 获取所有需求数据
export const GETNEEDLIST = {
  url: bussinessManUrl + '/demandsubmit/options',
  type: 'post'
}
export const GETCITYINFOLIST = {
  url: bussinessManUrl + '/rest/city/query',
  type: 'get'
}
export const GETCITYINFOS = (params, func) =>
  // req(params, func, bussinessManUrl + `/rest/city/query?page=1&limit=9999999`, 'get')
  req(params, func, bussinessManUrl + `/rest/city/query`, 'post')
// 新增或修改城市
export const INSERTCITYINFOS = (params, func) =>
  req(params, func, bussinessManUrl + `/rest/city/info`, 'post')
// 删除城市
export const REMOVECITYINFOS = (params, func) =>
  req(params, func, bussinessManUrl + `/rest/city/remove`, 'post')
// 需求审批通过
export const NEEDACCEPT = (params, func) =>
  req(params, func, bussinessManUrl + '/demandsubmit/accept', 'post')
// 需求审批拒绝
export const NEEDREJECT = (params, func) =>
  req(params, func, bussinessManUrl + '/demandsubmit/refuse', 'post')
// 需求文件上传
export const UPLOADNEEDFILE = {
  url: bussinessManUrl + '/demandsubmit/uploadFile',
  accept: '.xml'
}
// 新增需求
export const NEEDINSERT = (params, func) =>
  req(params, func, bussinessManUrl + '/demandsubmit/insertselect', 'post')
// 新增生产任务
export const ADDPRODUCTTASK = (params, func) =>
  req(params, func, bussinessManUrl + '/productdemand/insertselect', 'post')
// 生产任务单上传
export const UPLOADPRODUCT = {
  url: bussinessManUrl + '/productdemand/uploadFile',
  accept: '.xml'
}
// 获取指定生产任务
export const GETPRODUCTSELECT = (params, func) =>
  req(params, func, bussinessManUrl + '/productdemand/selectbykey?id=' + params.id, 'get')
// 新增评估任务
export const ADDESTIMATETASK = (params, func) =>
  req(params, func, bussinessManUrl + '/estimatetask/insertselect', 'post')
// 评估任务单上传
export const UPLOADESTIMATE = {
  url: bussinessManUrl + '/estimatetask/uploadFile',
  accept: '.xml'
}
// 获取所有的服务名
export const GETALLSERVICE = (params, func) =>
  req(params, func, bussinessManUrl + '/estimatetask/getservice', 'post')
// 获取所有生产任务
export const GETPRODUCTLIST = {
  url: bussinessManUrl + '/productdemand/options',
  type: 'post'
}
// 编辑生产任务
export const GETFLOWJSON = (params, func) =>
  req(params, func, bussinessManUrl + '/productdemand/getJson', 'post')
// 保存生产任务
export const SAVEFLOWJSON = (params, func) =>
  req(params, func, bussinessManUrl + '/productdemand/editJson', 'post')

// 生产任务审批通过
export const PRODUCTACCEPT = (params, func) =>
  req(params, func, bussinessManUrl + '/productdemand/accept', 'post')
// 生产任务审批拒绝
export const PRODUCTREJECT = (params, func) =>
  req(params, func, bussinessManUrl + '/productdemand/refuse', 'post')
// 获取所有的分类
export const GETALLCLASSIFY = (params, func) =>
  req(params, func, bussinessManUrl + '/estimatetask/getclassify', 'post')
// 获取所有评估任务
export const GETESTIMATELIST = {
  url: bussinessManUrl + '/estimatetask/options',
  type: 'post'
}
// 评估任务审批通过
export const ESTIMATEACCEPT = (params, func) =>
  req(params, func, bussinessManUrl + '/estimatetask/accept', 'post')
// 评估任务审批拒绝
export const ESTIMATEREJECT = (params, func) =>
  req(params, func, bussinessManUrl + '/estimatetask/refuse', 'post')
// 获取数据
export const GETFLOWDATA = (params, func) =>
  req(params, func, bussinessManUrl + '/productdemand/getData', 'post')
// 评估任务下发
export const TRANSESTIMATE = (params, func) =>
  req(params, func, tranEstiUrl + '/rest/estimatetask/submit', 'post')
// 生产任务下发
export const TRANSPRODUCT = (params, func) =>
  req(params, func, tranProUrl + '/cms/task/TaskScheduleInterfaceAction.do?operate=saveTaskSchedule&operPage=returnJSON', 'post')
export const CALLBACKPROD = (params, func) =>
  req(params, func, bussinessManUrl + '/rest/callback/product', 'post')
export const CALLBACKESTI = (params, func) =>
  req(params, func, bussinessManUrl + '/rest/callback/evaluation', 'post')

/**
 * 用户中心接口
 * 包含单点登陆接口，认证接口数据获取接口
 * ****/
  // 获取权限树结构
export const PERMISSIONSTREE = (params, func) =>
  req(params, func, baseUserUrl + '/rest/role/tree', 'get')
  // 查询地理范围树结构
export const REGIONTREE = (params, func) =>
  req(params, func, baseUserUrl + '/rest/area/all', 'get')
export const PERMISSIONTREE = (params, func) =>
  req(params, func, baseUserUrl + '/rest/api/sys/tree', 'get')
// 获取用户
export const GETALLUSER = { url: baseUserUrl + '/rest/auth/users', type: 'post' }
// 添加用户
export const ADDUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/auth/user', 'post')
// 修改用户
export const UPDATEUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/auth/user', 'put')
// 注册用户激活及信息修改
export const ACTIVEUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/auth/activeUser', 'put')
// 删除用户
export const DELETEUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/auth/deleteUser', 'post')
// 审批拒绝
export const REJECTUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/auth/rejectUser', 'post')
// 获取角色
export const GETALLROLE = { url: baseUserUrl + '/rest/role/getAll', type: 'post' }
// 添加角色
export const ADDROLE = (params, func) =>
  req(params, func, baseUserUrl + '/rest/role/add', 'post')
// 修改角色
export const UPDATEROLE = (params, func) =>
  req(params, func, baseUserUrl + '/rest/role/update', 'post')
// 删除角色
export const DELETEROLE = (params, func) =>
  req(params, func, baseUserUrl + '/rest/role/delete', 'post')
// 获取角色列表
export const GETALLROLELIST = (params, func) =>
  req(params, func, baseUserUrl + '/rest/role/list', 'get')
// 获取组织机构列表
export const GETALLDEPARTMENTLIST = (params, func) =>
  req(params, func, baseUserUrl + '/department/tree', 'get')
// 新增部门
export const ADDDEPARTMENT = (params, func) =>
  req(params, func, baseUserUrl + '/department/add', 'post')
// 删除部门
export const DELETEDEPARTMENT = (params, func) =>
  req(params, func, baseUserUrl + '/department/delete', 'post')
// 更新部门
export const UPDATEDEPARTMENT = (params, func) =>
  req(params, func, baseUserUrl + '/department/update', 'post')
// 获取待审批用户数
export const GETAPPROVALUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/approve', 'get')
// 统计系统中所有可用账户数量
export const GETTOTALUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/total', 'get')
// 角色人员统计
export const GETROLEUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/roleusernum', 'get')
// 统计各个部门的人员数量
export const GETDEPARTMENTUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/departUsernum', 'get')
// 获取当前在线用户数量
export const GETONLINEUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/onlinesum', 'get')
// 获取当前累计访问量接口
export const GETLOGINCOUNT = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/logincount', 'get')
// 获取异常数
export const GETLOGINFAILEDCOUNT = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/loginfailedcount', 'get')
// 获取客户端在线量
export const GETAPPLOGIN = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/applogin', 'get')
// 获取生产作业人员
export const GETWORKINGMAN = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/productuser', 'get')
// 获取活跃用户
export const GETACTIVEUSER = (params, func) =>
  req(params, func, baseUserUrl + '/rest/audit/user/active?n=' + params, 'get')
/**
门户页面
**/
// 六个常见应用
export const GETTOPSIXAPP = (params, func) =>
  req(params, func, baseUserUrl + '/rest/api/sys/top6', 'get')
// 获取总应用数
export const GETTOTALAPP = (params, func) =>
  req(params, func, baseUserUrl + '/rest/api/sys/app/total', 'get')
// 获取系统热度
export const GETSYSTEMHOT = (params, func) =>
  req(params, func, baseUserUrl + '/rest/api/sys/hot', 'get')
// 获取当前用户的可用应用
export const GETAVAILABLEAPP = (params, func) =>
  req(params, func, baseUserUrl + '/rest/api/sys/app/all?limit=' + params.limit + '&page=' + params.page + '&keyWord=' + params.keyWord, 'get')
// 获取当前所有应用累计访问次数
export const GETACCESSCOUNT = (params, func) =>
  req(params, func, baseUserUrl + '/rest/api/sys/access/count', 'get')
// 获取当前用户7日访问次数
export const GETSEVENDAYSCOUNT = (params, func) =>
  req(params, func, baseUserUrl + '/rest/api/sys/access/7days', 'get')
// 应用访问统计次数接口
export const COUNTACCESS = (params, func) =>
  req(params, func, baseUserUrl + '/rest/api/sys/access', 'post')
